package com.ds.esd.bpm.custom.plugins.right;

import com.alibaba.fastjson.annotation.JSONField;
import com.ds.bpm.client.RouteToType;
import com.ds.bpm.engine.WorkflowClientService;
import com.ds.bpm.enums.right.PerformGroupEnums;
import com.ds.esd.custom.buttonviews.annotation.ButtonViewsAnnotation;
import com.ds.esd.custom.nav.tab.annotation.TabItemAnnotation;
import com.ds.esd.tool.ui.component.item.TabListItem;
import com.ds.esd.tool.ui.enums.BarLocationType;
import com.ds.esd.tool.ui.enums.VAlignType;
import com.ds.jds.core.esb.EsbUtil;
import com.ds.web.annotation.Pid;

@ButtonViewsAnnotation(barLocation = BarLocationType.left, barVAlign = VAlignType.top, autoReload = false)
public class MultiActivityTree extends TabListItem {

    @Pid
    public String topOrgId;
    @Pid
    public RouteToType action;
    @Pid
    public String activityInstId;
    @Pid
    public String nextActivityDefId;
    @Pid
    public String performGroup;


    @TabItemAnnotation
    public MultiActivityTree(PerformGroupItem performGroupItem, String activityInstId, RouteToType action, String topOrgId, String nextActivityDefId) {
        super(performGroupItem.getType(), performGroupItem.getName(), performGroupItem.getImageClass());
        this.setName(performGroupItem.getType());
        this.setDesc(performGroupItem.getName());
        this.topOrgId = topOrgId;
        this.action = action;
        this.activityInstId = activityInstId;
        this.nextActivityDefId = nextActivityDefId;
    }

    public String getTopOrgId() {
        return topOrgId;
    }

    public void setTopOrgId(String topOrgId) {
        this.topOrgId = topOrgId;
    }

    public RouteToType getAction() {
        return action;
    }

    public void setAction(RouteToType action) {
        this.action = action;
    }

    public String getActivityInstId() {
        return activityInstId;
    }

    public void setActivityInstId(String activityInstId) {
        this.activityInstId = activityInstId;
    }

    public String getNextActivityDefId() {
        return nextActivityDefId;
    }

    public void setNextActivityDefId(String nextActivityDefId) {
        this.nextActivityDefId = nextActivityDefId;
    }

    public String getPerformGroup() {
        return performGroup;
    }

    public void setPerformGroup(String performGroup) {
        this.performGroup = performGroup;
    }

    /**
     * @return
     */
    @JSONField(serialize = false)
    public WorkflowClientService getClient() {
        WorkflowClientService client = ((WorkflowClientService) EsbUtil.parExpression("$BPMC"));
        return client;
    }
}
